const connection = require('../app/database');

class UploadService{
  async createAvatar(filename,size, mimetype,userId){
      const sql = `INSERT INTO avatar (filename,size,mimetype,user_id) VALUES (?,?,?,?)`;
    const result = await connection.execute(sql,[filename,size,mimetype,userId]);
    return result[0];
  }
  async createPicture(filename,size, mimetype,userId,momentId){
try {
  console.log(filename,size, mimetype,userId,momentId)
  const sql = `INSERT INTO file (filename,size,mimetype,user_id,moment_id) VALUES (?,?,?,?,?)`;
  const result = await connection.execute(sql,[filename,size,mimetype,userId,momentId]);
  return result[0];
}catch (e) {
  console.log(e);
}
  }
}
module.exports =new UploadService();